package le.grand;

import java.util.ArrayList;
import java.util.List;

public class HotelInfo {

	String hotelName;

	private List<ReservationInfo> reservations = new ArrayList<>();

	public HotelInfo(String hotelName) {
		this.hotelName = hotelName;
	}

	public void addReservation(ReservationInfo ri) {
		System.out.println("Adding reservation: " + ri.toString());
		reservations.add(ri);
	}
	
	ReservationInfo getRes(int n) {
		for (ReservationInfo ri : reservations) {
			if(ri.getReservationNumber() == n) {
				return ri;
			}
		}
		return null;
	}

	public int getTotalNumOfPassengers() {
		int k = 0;
		for (ReservationInfo ri : reservations) {
			k += ri.getTotalNumOfPassengers();
		}
		return k;
	}
	
	public int getNumOfChildren() {
		int k = 0;
		for (ReservationInfo ri : reservations) {
			k += ri.getNumOfChildren();
		}
		return k;
	}
	
	public void append(HotelInfo other) {
		reservations.addAll(other.reservations);
	}

	public String getHotelName() {
		return hotelName;
	}

	public List<ReservationInfo> getReservations() {
		return reservations;
	}

}
